package com.example.flinkcourse.lesson5.config;

import lombok.Data;
import lombok.Builder;

/**
 * 配置类
 * 用于管理所有环境变量和连接信息
 */
@Data
@Builder
public class Config {
    // MySQL 配置
    private String mysqlHost;
    private int mysqlPort;
    private String mysqlUsername;
    private String mysqlPassword;
    private String mysqlDatabase;
    
    // Doris 配置
    private String dorisHost;
    private int dorisPort;
    private String dorisUsername;
    private String dorisPassword;
    private String dorisDatabase;
    
    // StarRocks 配置
    private String starRocksHost;
    private int starRocksPort;
    private String starRocksUsername;
    private String starRocksPassword;
    private String starRocksDatabase;
    
    // Kafka 配置
    private String kafkaBootstrapServers;
    private String kafkaTopic;
    private String kafkaGroupId;
    private boolean kafkaKerberosEnabled;
    private String kafkaKerberosPrincipal;
    private String kafkaKerberosKeytab;
    
    // PostgreSQL 配置
    private String postgresHost;
    private int postgresPort;
    private String postgresUsername;
    private String postgresPassword;
    private String postgresDatabase;
    
    // Flink 配置
    private String flinkCheckpointDir;
    private int flinkParallelism;
    private long flinkCheckpointInterval;
    
    // MongoDB 配置
    private String mongoHost;
    private int mongoPort;
    private String mongoUsername;
    private String mongoPassword;
    private String mongoDatabase;
    
    // Elasticsearch 配置
    private String esHost;
    private int esPort;
    private String esUsername;
    private String esPassword;
    
    /**
     * 创建默认配置
     */
    public static Config createDefault() {
        return Config.builder()
            // MySQL 默认配置
            .mysqlHost("localhost")
            .mysqlPort(3306)
            .mysqlUsername("root")
            .mysqlPassword("123456")
            .mysqlDatabase("test")
            
            // Doris 默认配置
            .dorisHost("localhost")
            .dorisPort(9030)
            .dorisUsername("root")
            .dorisPassword("")
            .dorisDatabase("test")
            
            // StarRocks 默认配置
            .starRocksHost("localhost")
            .starRocksPort(9030)
            .starRocksUsername("root")
            .starRocksPassword("")
            .starRocksDatabase("test")
            
            // Kafka 默认配置
            .kafkaBootstrapServers("localhost:9092")
            .kafkaTopic("test")
            .kafkaGroupId("test-group")
            .kafkaKerberosEnabled(false)
            
            // PostgreSQL 默认配置
            .postgresHost("localhost")
            .postgresPort(5432)
            .postgresUsername("postgres")
            .postgresPassword("postgres")
            .postgresDatabase("test")
            
            // Flink 默认配置
            .flinkCheckpointDir("hdfs:///flink/checkpoints")
            .flinkParallelism(2)
            .flinkCheckpointInterval(60000)
            
            // MongoDB 默认配置
            .mongoHost("localhost")
            .mongoPort(27017)
            .mongoUsername("root")
            .mongoPassword("123456")
            .mongoDatabase("test")
            
            // Elasticsearch 默认配置
            .esHost("localhost")
            .esPort(9200)
            .esUsername("")
            .esPassword("")
            
            .build();
    }
} 